package com.icesoft.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.icesoft.framework.core.annotation.Entity;
import com.icesoft.framework.core.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

@Getter
@Setter
@Accessors(chain = true)
@TableName("sys_account")
@Entity(module = "system", describe = "账号")
public class Account extends BaseEntity {

	@NotNull(message = "用户ID不能为空")
	@TableField()
	@Column(value = "user_id")
	private Long userId;

	@NotNull(message = "用户类型不能为空")
	@Length(max = 100, message = "用户类型长度应小于100")
	@TableField()
	@Column(value = "user_type")
	private String userType;

	@NotNull(message = "认证方式不能为空")
	@Length(max = 20, message = "认证方式长度应小于20")
	@TableField()
	@Column(value = "auth_type")
	private String authType;

	@NotNull(message = "用户名不能为空")
	@Length(max = 100, message = "用户名长度应小于100")
	@TableField()
	@Column(value = "auth_account")
	private String authAccount;

	@JsonIgnore
	@Length(max = 32, message = "密码长度应小于32")
	@TableField()
	@Column(value = "auth_secret")
	private String authSecret;

	@JsonIgnore
	@Length(max = 32, message = "加密盐长度应小于32")
	@TableField()
	@Column(value = "secret_salt")
	private String secretSalt;

}
